﻿
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sproc_Linkman_UpdateCustomLinkman]') AND type in (N'P', N'PC'))
    DROP PROCEDURE [dbo].[sproc_Linkman_UpdateCustomLinkman];
GO
CREATE PROCEDURE [dbo].[sproc_Linkman_UpdateCustomLinkman]
@ID            int,
@Name            nvarchar(100),
@Gender            bit,
@UnitTelephone        nvarchar(50),
@Email            nvarchar(50),
@UnitAddress        nvarchar(200),
@UnitZip        nvarchar(50),
@FamilyAddress        nvarchar(200),
@FamilyZip        nvarchar(50),
@Mobile            nvarchar(100),
@FamilyTelephone    nvarchar(50),
@Memo            nvarchar(1000),
@Age            nvarchar(50),
@Type            nvarchar(200)
/*-------------------------------------------------
功能： 添加自定义联系人
参数：
@ID            ID
@Name            姓名
@Gender            性别（1男0女）
@UnitTelephone        单位电话
@Email            email
@UnitAddress        单位地址
@UnitZip        单位邮编
@FamilyAddress        家庭地址
@FamilyZip        家庭邮编
@Mobile            手机
@FamilyTelephone    家庭电话
@Memo            备注
@Age            年龄
@Type            类别
-----------------------------------------------------*/
AS
    DECLARE @LinkmanID int

    UPDATE  UDS_Linkman_CustomLinkman SET
                        Name=@Name        ,
                        Age=@Age        ,        
                        Gender=@Gender        ,        
                        UnitTelephone=@UnitTelephone    ,    
                        Email=@Email        ,        
                        UnitAddress=@UnitAddress    ,
                        UnitZip=@UnitZip        ,
                        FamilyAddress=@FamilyAddress    ,
                        FamilyZip=@FamilyZip    ,
                        Mobile=@Mobile        ,
                        FamilyTelephone=@FamilyTelephone    ,
                        Memo=@Memo
    WHERE ID=@ID
    
    DELETE FROM UDS_Linkman_TypeOfCustomLinkman WHERE CustomLinkmanID=@ID